<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>医嘱模板</title>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
    <script src="../../lib/layui/layui.js"></script>
    <script src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<div id="view3"></div>
</body>
</html>
<!--医嘱模板-->
<script id="medical_advice" type="text/html">
    <div class="layui-card layui-anim layui-anim-upbit">
        <div class="layui-card-header">{{d.t_name}}<button onclick=inportTemplate("{{d.t_medical_advice}}") type="button" class="layui-btn layui-btn-sm  layui-btn-radius" style="float:right">导入</button></div>
        <div class="layui-card-body">
            <ul>
                <li>医嘱:{{d.t_medical_advice}}</li>
            </ul>
        </div>
    </div>
</script>
<!--给医嘱模板赋值-->
<script>
    $(function(){
        //获取模板里的数据
        useAjax("/JT90/getMedical_advice",null,"JSON","GET",function(map){
            if (map.success){
                var data = map.data;
                $.each(data, function (index, item) {
                    renderView3(item);
                })
            }
        })
    })
    function renderView3(data){
        layui.use("laytpl",function(){
            var laytpl=layui.laytpl;	             //获取laytpl操作对象
            var getTpl = $("#medical_advice").html();	    //获取页面的js模板
            laytpl(getTpl).render(data, function(html){
                $("#view3").append(html);	          //添加新的数据
            });
        })
    }
    //导入的方法
    function inportTemplate(data){
        parent.doctorWord(data);
        xadmin.close();
    }
</script>